<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta http-equiv="cache-control" content="no-cache">
<title>Genivia - DIME attachment functions</title>
<link href="genivia_tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="genivia_content.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="top">
 <div id="titlearea">
  <table height="72px" width="100%" cellspacing="0" cellpadding="0">
   <tbody>
    <tr>
     <td width="10%">&nbsp;</td>
     <td width="175px"><a href="https://www.genivia.com"><img alt="Genivia" src="GeniviaLogo2_trans_noslogan.png"/></a></td>
     <td class="tab_home"><a href="https://www.genivia.com">Home</a></td>
     <td class="tab_home"><a href="https://www.genivia.com/docs.html">Documentation</a></td>
     <td>
      <div style="float: right; font-size: 18px; font-weight: bold;">DIME attachment functions</div>
      <br>
      <div style="float: right; font-size: 10px;">updated Tue Apr 20 2021 by Robert van Engelen</div>
     </td>
     <td width="10%">&nbsp;</td>
    </tr>
   </tbody>
  </table>
 </div>
<!-- Generated by Doxygen 1.8.11 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__dime.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">DIME attachment functions</div>  </div>
</div><!--header-->
<div class="contents">

<p>This module defines functions to set and get DIME attachments.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structxsd____base64_binary.html">xsd__base64Binary</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">XSD base64Binary structure with attachment data.  <a href="structxsd____base64_binary.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct__xop_____include.html">_xop__Include</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">XOP include structure with attachment data.  <a href="struct__xop_____include.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structxsd____hex_binary.html">xsd__hexBinary</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">XSD hexBinary structure with attachment data.  <a href="structxsd____hex_binary.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structsoap__dime.html">soap_dime</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Stores a linked list of DIME attachments received.  <a href="structsoap__dime.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga466502a32af0672d589e919a7c882a57"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__dime.html#ga466502a32af0672d589e919a7c882a57">soap_set_dime</a> (struct <a class="el" href="structsoap.html">soap</a> *<a class="el" href="structsoap.html">soap</a>)</td></tr>
<tr class="memdesc:ga466502a32af0672d589e919a7c882a57"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable DIME attachments.  <a href="#ga466502a32af0672d589e919a7c882a57">More...</a><br /></td></tr>
<tr class="separator:ga466502a32af0672d589e919a7c882a57"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7f319170ba950c4b4025c5c1739a26fc"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__dime.html#ga7f319170ba950c4b4025c5c1739a26fc">soap_clr_dime</a> (struct <a class="el" href="structsoap.html">soap</a> *<a class="el" href="structsoap.html">soap</a>)</td></tr>
<tr class="memdesc:ga7f319170ba950c4b4025c5c1739a26fc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disable DIME attachments.  <a href="#ga7f319170ba950c4b4025c5c1739a26fc">More...</a><br /></td></tr>
<tr class="separator:ga7f319170ba950c4b4025c5c1739a26fc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga742f96848174e27bfc8df7425b870f4b"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__dime.html#ga742f96848174e27bfc8df7425b870f4b">soap_set_dime_attachment</a> (struct <a class="el" href="structsoap.html">soap</a> *<a class="el" href="structsoap.html">soap</a>, const char *ptr, size_t size, const char *type, const char *id, unsigned short optype, const char *option)</td></tr>
<tr class="memdesc:ga742f96848174e27bfc8df7425b870f4b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a DIME attachment to the SOAP/XML message.  <a href="#ga742f96848174e27bfc8df7425b870f4b">More...</a><br /></td></tr>
<tr class="separator:ga742f96848174e27bfc8df7425b870f4b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4829f833abe74febcb8e5fe9360ab591"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__dime.html#ga4829f833abe74febcb8e5fe9360ab591">soap_dime_option</a> (struct <a class="el" href="structsoap.html">soap</a> *<a class="el" href="structsoap.html">soap</a>, unsigned short optype, const char *option)</td></tr>
<tr class="memdesc:ga4829f833abe74febcb8e5fe9360ab591"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a DIME option.  <a href="#ga4829f833abe74febcb8e5fe9360ab591">More...</a><br /></td></tr>
<tr class="separator:ga4829f833abe74febcb8e5fe9360ab591"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>This module defines functions to set and get DIME attachments. </p>
<p>For more information on the DIME protocol, see for example <a href="https://msdn.microsoft.com/en-us/library/aa480488.aspx">https://msdn.microsoft.com/en-us/library/aa480488.aspx</a></p>
<p>There are two ways to add DIME attachments to SOAP/XML messages for sending:</p><ul>
<li>use <code><a class="el" href="group__group__dime.html#ga742f96848174e27bfc8df7425b870f4b" title="Add a DIME attachment to the SOAP/XML message. ">soap_set_dime_attachment</a></code> to explicitly add an attachment that contains the specified source of data;</li>
<li>use <code><a class="el" href="structxsd____base64_binary.html" title="XSD base64Binary structure with attachment data. ">xsd__base64Binary</a></code> or <code><a class="el" href="struct__xop_____include.html" title="XOP include structure with attachment data. ">_xop__Include</a></code> structures in the serializable data of a SOAP/XML message, where the specified data is serialized in DIME attachments automatically when one of the <code>id</code>, <code>type</code> or <code>options</code> member variables are non-NULL.</li>
</ul>
<p>Both methods also support streaming DIME attachments to send using the <code><a class="el" href="group__group__callbacks.html#ga068455ce417bddb1636d4d565e0ebf56" title="Callback to open a streaming DIME attachment for reading. ">soap::fdimereadopen</a></code>, <code><a class="el" href="group__group__callbacks.html#ga48270ad98961c3ff48c7b56484ebb3fa" title="Callback to read data in a DIME attachment stream. ">soap::fdimeread</a></code>, and <code><a class="el" href="group__group__callbacks.html#ga154752e553be41ed3b10fe3a1273ac71" title="Callback to close a DIME attachment stream after reading. ">soap::fdimereadclose</a></code> callbacks that fetch the data to send, where a user-defined handle should be specified for the <code>ptr</code> parameter of <code><a class="el" href="group__group__dime.html#ga742f96848174e27bfc8df7425b870f4b" title="Add a DIME attachment to the SOAP/XML message. ">soap_set_dime_attachment</a></code> or the <code><a class="el" href="structxsd____base64_binary.html#a6ba9f9e291b2b26e0696bd48f4e983be" title="pointer to binary data ">xsd__base64Binary::__ptr</a></code> member variable instead of a pointer to the actual data. This handle can be used by the callbacks to fetch the specific data to transmit.</p>
<p>Receiving DIME attachments attached to SOAP/XML messages is automatic. The DIME attachments are converted to binary data and stored in the <code><a class="el" href="structxsd____base64_binary.html" title="XSD base64Binary structure with attachment data. ">xsd__base64Binary</a></code> structures that reference the DIME attachments via the <code><a class="el" href="structxsd____base64_binary.html#a6398e9d86079896facc3005871d7fe27" title="extra member: NULL to generate an id or assign this member variable a unique UUID ...">xsd__base64Binary::id</a></code> string, meaning that the <code><a class="el" href="structxsd____base64_binary.html#a6ba9f9e291b2b26e0696bd48f4e983be" title="pointer to binary data ">xsd__base64Binary::__ptr</a></code> (points to the data) and <code><a class="el" href="structxsd____base64_binary.html#aa2dfd4d99f8280c413b9ff25a69a8729" title="size of the binary data ">xsd__base64Binary::__size</a></code> (data length) are populated automatically with the DIME binary data. However, if the streaming DIME callbacks <code><a class="el" href="group__group__callbacks.html#ga3b1e4aa046b683535110a34fc46ab1eb" title="Callback to open a streaming DIME attachment for writing. ">soap::fdimewriteopen</a></code>, <code><a class="el" href="group__group__callbacks.html#ga0f3214caa607f74505f11c76ade85cce" title="Callback to write data in a DIME attachment stream. ">soap::fdimewrite</a></code>, and <code><a class="el" href="group__group__callbacks.html#ga1ea0ca0526c4ccba02ec52f62e0678a9" title="Callback to close a DIME attachment stream after writing. ">soap::fdimewriteclose</a></code> are defined then the attachments are streamed to these callbacks instead.</p>
<p>For example, to send and receive a SOAP/XML message with DIME attachments using a serializable <code><a class="el" href="structxsd____base64_binary.html" title="XSD base64Binary structure with attachment data. ">xsd__base64Binary</a></code> structure:</p>
<div class="fragment"><div class="line"><span class="comment">// example .h file for soapcpp2</span></div><div class="line"><span class="comment">//gsoap ns service name: example</span></div><div class="line"><span class="comment">//gsoap ns service namespace: urn:example</span></div><div class="line"><span class="keyword">struct </span><a class="code" href="structxsd____base64_binary.html">xsd__base64Binary</a> {</div><div class="line">  <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *<a class="code" href="structxsd____base64_binary.html#a6ba9f9e291b2b26e0696bd48f4e983be">__ptr</a>; <span class="comment">// pointer to binary data</span></div><div class="line">  <span class="keywordtype">int</span> <a class="code" href="structxsd____base64_binary.html#aa2dfd4d99f8280c413b9ff25a69a8729">__size</a>;           <span class="comment">// size of the binary data</span></div><div class="line">  <span class="keywordtype">char</span> *<a class="code" href="structxsd____base64_binary.html#a6398e9d86079896facc3005871d7fe27">id</a>;             <span class="comment">// NULL to generate an id or assign this member variable a unique UUID</span></div><div class="line">  <span class="keywordtype">char</span> *<a class="code" href="structxsd____base64_binary.html#acbc2d7ba24334ccc4f8ec36e9122e9e5">type</a>;           <span class="comment">// MIME type of the data</span></div><div class="line">  <span class="keywordtype">char</span> *<a class="code" href="structxsd____base64_binary.html#a16d2bb03d68bf276bad5fd7cccd55bbe">options</a>;        <span class="comment">// DIME options</span></div><div class="line">};</div><div class="line"><span class="keywordtype">int</span> ns__webmethod(<span class="keyword">struct</span> <a class="code" href="structxsd____base64_binary.html">xsd__base64Binary</a> *data, <span class="keyword">struct</span> <a class="code" href="structxsd____base64_binary.html">xsd__base64Binary</a> *result);</div></div><!-- fragment --><div class="fragment"><div class="line"><span class="comment">// example client implementation based on the above example .h file for soapcpp2</span></div><div class="line"><span class="preprocessor">#include &quot;soapH.h&quot;</span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main()</div><div class="line">{</div><div class="line">  <span class="keyword">struct </span>soap *soap = <a class="code" href="group__group__context.html#ga87c20488b2dc680aaa7689b1d024989c">soap_new</a>();</div><div class="line">  <span class="keyword">struct </span><a class="code" href="structxsd____base64_binary.html">xsd__base64Binary</a> data, result;</div><div class="line">  data.<a class="code" href="structxsd____base64_binary.html#a6ba9f9e291b2b26e0696bd48f4e983be">__ptr</a> = ...;  <span class="comment">// points to binary image data to send</span></div><div class="line">  data.__size = ...; <span class="comment">// size of the image data to send</span></div><div class="line">  data.id = NULL;    <span class="comment">// this will be assigned by the engine</span></div><div class="line">  data.type = <span class="stringliteral">&quot;image/jpg&quot;</span>;</div><div class="line">  data.options = <a class="code" href="group__group__dime.html#ga4829f833abe74febcb8e5fe9360ab591">soap_dime_option</a>(soap, 0, <span class="stringliteral">&quot;Picture.png&quot;</span>); <span class="comment">// DIME option 0 = &quot;Picture.png&quot; to store file name</span></div><div class="line">  <span class="keywordflow">if</span> (soap_call_ns__webmethod(soap, endpoint, NULL, &amp;data, &amp;result))</div><div class="line">    <a class="code" href="group__group__fault.html#ga931a4ab6df2553b48a0c270f8a0a88af">soap_print_fault</a>(soap, stderr);</div><div class="line">  <span class="keywordflow">else</span></div><div class="line">    ... <span class="comment">// success, use the result</span></div><div class="line">  <a class="code" href="group__group__context.html#gaf7d0176161e9def36981e24faa1913d9">soap_destroy</a>(soap);</div><div class="line">  <a class="code" href="group__group__context.html#ga81a009ae1ea825a05e5241e2b7a8ece9">soap_end</a>(soap);</div><div class="line">  <a class="code" href="group__group__context.html#ga57108ca4681186e58b5b189c3528f10a">soap_free</a>(soap);</div><div class="line">}</div></div><!-- fragment --><div class="fragment"><div class="line"><span class="comment">// example service implementation based on the above example .h file for soapcpp2</span></div><div class="line"><span class="preprocessor">#include &quot;soapH.h&quot;</span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main()</div><div class="line">{</div><div class="line">  <span class="keyword">struct </span>soap *soap = <a class="code" href="group__group__context.html#ga87c20488b2dc680aaa7689b1d024989c">soap_new</a>();</div><div class="line">  ... <span class="comment">// serve requests with soap_bind, soap_accept, soap_ssl_accept, and soap_serve</span></div><div class="line">}</div><div class="line"><span class="keywordtype">int</span> ns__webmethod(<span class="keyword">struct</span> soap *soap, <span class="keyword">struct</span> <a class="code" href="structxsd____base64_binary.html">xsd__base64Binary</a> *data, <span class="keyword">struct</span> <a class="code" href="structxsd____base64_binary.html">xsd__base64Binary</a> *result)</div><div class="line">{</div><div class="line">  <span class="comment">// echo back the structure (as a DIME attachment)</span></div><div class="line">  result-&gt;<a class="code" href="structxsd____base64_binary.html#a6ba9f9e291b2b26e0696bd48f4e983be">__ptr</a> = data-&gt;<a class="code" href="structxsd____base64_binary.html#a6ba9f9e291b2b26e0696bd48f4e983be">__ptr</a>;</div><div class="line">  result-&gt;<a class="code" href="structxsd____base64_binary.html#aa2dfd4d99f8280c413b9ff25a69a8729">__size</a> = data-&gt;<a class="code" href="structxsd____base64_binary.html#aa2dfd4d99f8280c413b9ff25a69a8729">__size</a>;</div><div class="line">  retult-&gt;id = data-&gt;<a class="code" href="structxsd____base64_binary.html#a6398e9d86079896facc3005871d7fe27">id</a>;</div><div class="line">  retult-&gt;type = data-&gt;<a class="code" href="structxsd____base64_binary.html#acbc2d7ba24334ccc4f8ec36e9122e9e5">type</a>;</div><div class="line">  retult-&gt;options = data-&gt;<a class="code" href="structxsd____base64_binary.html#a16d2bb03d68bf276bad5fd7cccd55bbe">options</a>;</div><div class="line">  <span class="keywordflow">return</span> <a class="code" href="group__group__errors.html#ga3b10a68f354f39cbb0fe0d043ad4c7c0">SOAP_OK</a>;</div><div class="line">}</div></div><!-- fragment --><p>Besides receiving the attachments in <code><a class="el" href="structxsd____base64_binary.html" title="XSD base64Binary structure with attachment data. ">xsd__base64Binary</a></code> structures, on the receiving side you can also iterate over the DIME attachments received as follows:</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &quot;soapH.h&quot;</span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main()</div><div class="line">{</div><div class="line">  <span class="keyword">struct </span>soap *soap = <a class="code" href="group__group__context.html#ga87c20488b2dc680aaa7689b1d024989c">soap_new</a>();</div><div class="line">  ... <span class="comment">// call soap_call_ns__webmethod etc.</span></div><div class="line">  {</div><div class="line">    <span class="keywordtype">int</span> n = 0;</div><div class="line">    <span class="keyword">struct </span><a class="code" href="structsoap__multipart.html">soap_multipart</a> *attachment;</div><div class="line">    <span class="keywordflow">for</span> (attachment = soap-&gt;<a class="code" href="structsoap.html#a38845a4e0cc0696782769ac9976c4dfa">dime</a>.<a class="code" href="structsoap__dime.html#a478a23b3994a35d1c0945751106cb4f6">list</a>; attachment; attachment = attachment-&gt;<a class="code" href="structsoap__multipart.html#a5521c92e49758ed873d0a8b2ec4b25c8">next</a>)</div><div class="line">    {</div><div class="line">      ++n;</div><div class="line">      printf(<span class="stringliteral">&quot;Part %d:\n&quot;</span>, n);</div><div class="line">      printf(<span class="stringliteral">&quot;ptr   =%p\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#a640f46b605042f37ae1592f77e31c52d">ptr</a>);</div><div class="line">      printf(<span class="stringliteral">&quot;size  =%ul\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#afc4b69f5e9ade6526b23681c105d5ca5">size</a>);</div><div class="line">      printf(<span class="stringliteral">&quot;id    =%s\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#ad0bcd79b40a1bc1dc13fc343477f5564">id</a> ? attachment-&gt;<a class="code" href="structsoap__multipart.html#ad0bcd79b40a1bc1dc13fc343477f5564">id</a> : <span class="stringliteral">&quot;&quot;</span>);</div><div class="line">      printf(<span class="stringliteral">&quot;type  =%s\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#a495c8d20e0334be1b1345193ca2fb764">type</a> ? attachment-&gt;<a class="code" href="structsoap__multipart.html#a495c8d20e0334be1b1345193ca2fb764">type</a> : <span class="stringliteral">&quot;&quot;</span>);</div><div class="line">      <span class="comment">// DIME options are formatted according to the DIME protocol</span></div><div class="line">      <span class="keywordflow">if</span> (attachment-&gt;<a class="code" href="structsoap__multipart.html#a61d8ba579009b3aa64f9509cacca10ef">options</a>)</div><div class="line">      {</div><div class="line">        <span class="comment">// extract length of first option</span></div><div class="line">        <span class="keywordtype">size_t</span> len = ((<span class="keywordtype">unsigned</span> char)attachment-&gt;<a class="code" href="structsoap__multipart.html#a61d8ba579009b3aa64f9509cacca10ef">options</a>[2] &lt;&lt; 8) | ((<span class="keywordtype">unsigned</span> char)attachment-&gt;<a class="code" href="structsoap__multipart.html#a61d8ba579009b3aa64f9509cacca10ef">options</a>[3]);</div><div class="line">        <span class="comment">// allocate and copy the first option, which is assumed to be a name</span></div><div class="line">        <span class="keywordtype">char</span> *name = (<span class="keywordtype">char</span>*)<a class="code" href="group__group__context.html#gaba556710e010feeb2211ed43b5bf059c">soap_malloc</a>(soap, len + 1);</div><div class="line">        strncpy(name, attachment-&gt;<a class="code" href="structsoap__multipart.html#a61d8ba579009b3aa64f9509cacca10ef">options</a> + 4, len);</div><div class="line">        name[len] = <span class="charliteral">&#39;\0&#39;</span>;</div><div class="line">        printf(<span class="stringliteral">&quot;option=%s\n&quot;</span>, name);</div><div class="line">      }</div><div class="line">    }</div><div class="line">  }</div><div class="line">}</div></div><!-- fragment --><p>In C++ you can use an iterator for the last part of this example:</p>
<div class="fragment"><div class="line"><span class="keyword">struct </span>soap *soap = <a class="code" href="group__group__context.html#ga87c20488b2dc680aaa7689b1d024989c">soap_new</a>();</div><div class="line">... <span class="comment">// call soap_call_ns__webmethod etc.</span></div><div class="line"><span class="keywordtype">int</span> n = 0;</div><div class="line"><span class="keywordflow">for</span> (<a class="code" href="structsoap__multipart.html#ad9000ffe8f72fef89038c4773efdf575">soap_multipart::iterator</a> i = soap-&gt;<a class="code" href="structsoap.html#a38845a4e0cc0696782769ac9976c4dfa">dime</a>.<a class="code" href="structsoap__dime.html#a4fe0d524cff9e2e467487dba18dd61f8">begin</a>(); i != soap-&gt;<a class="code" href="structsoap.html#a38845a4e0cc0696782769ac9976c4dfa">dime</a>.<a class="code" href="structsoap__dime.html#af4c0808ed995d085514cfc0962bb4565">end</a>(); ++i)</div><div class="line">{</div><div class="line">  ++n;</div><div class="line">  printf(<span class="stringliteral">&quot;Part %d:\n&quot;</span>, n);</div><div class="line">  printf(<span class="stringliteral">&quot;ptr   =%p\n&quot;</span>, i-&gt;ptr);</div><div class="line">  ... <span class="comment">// etc</span></div><div class="line">}</div></div><!-- fragment --><p>At the server side the code to retrieve the DIME attachments is the same. </p>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga7f319170ba950c4b4025c5c1739a26fc"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void soap_clr_dime </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structsoap.html">soap</a> *&#160;</td>
          <td class="paramname"><em>soap</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Disable DIME attachments. </p>
<p>This function disables DIME attachments, unless the data to serialize as an XML message contains attachments defined by <code><a class="el" href="structxsd____base64_binary.html" title="XSD base64Binary structure with attachment data. ">xsd__base64Binary</a></code> and <code><a class="el" href="struct__xop_____include.html" title="XOP include structure with attachment data. ">_xop__Include</a></code> structures. </p>

</div>
</div>
<a class="anchor" id="ga4829f833abe74febcb8e5fe9360ab591"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char* soap_dime_option </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structsoap.html">soap</a> *&#160;</td>
          <td class="paramname"><em>soap</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned short&#160;</td>
          <td class="paramname"><em>optype</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>option</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Creates a DIME option. </p>
<p>This function creates a DIME option-formatted string for the <code><a class="el" href="structxsd____base64_binary.html#a16d2bb03d68bf276bad5fd7cccd55bbe" title="extra member: DIME options or a description of the MIME attachment or NULL ">xsd__base64Binary::options</a></code> member variable or <code><a class="el" href="struct__xop_____include.html#a894a54df2d052989ff2c20d344f56c91" title="description of the MIME/MTOM attachment or NULL ">_xop__Include::options</a></code> member variable.</p><dl class="section return"><dt>Returns</dt><dd>a DIME option-formatted string </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">soap</td><td><code><a class="el" href="structsoap.html" title="Context with the engine state. ">soap</a></code> context </td></tr>
    <tr><td class="paramname">optype</td><td>a 16 bit DIME option type </td></tr>
    <tr><td class="paramname">option</td><td>one DIME option as a text string </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ga466502a32af0672d589e919a7c882a57"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int soap_set_dime </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structsoap.html">soap</a> *&#160;</td>
          <td class="paramname"><em>soap</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Enable DIME attachments. </p>
<p>This function enables sending DIME attachments. This function is generally not required because DIME attachments are automatically detected as <code><a class="el" href="structxsd____base64_binary.html" title="XSD base64Binary structure with attachment data. ">xsd__base64Binary</a></code> and <code><a class="el" href="struct__xop_____include.html" title="XOP include structure with attachment data. ">_xop__Include</a></code> structures in the data to serialize as an XML message with the attachments automatically added or DIME attachments can be explicitly added with <code><a class="el" href="group__group__dime.html#ga742f96848174e27bfc8df7425b870f4b" title="Add a DIME attachment to the SOAP/XML message. ">soap_set_dime_attachment</a></code>. </p>

</div>
</div>
<a class="anchor" id="ga742f96848174e27bfc8df7425b870f4b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int soap_set_dime_attachment </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structsoap.html">soap</a> *&#160;</td>
          <td class="paramname"><em>soap</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>ptr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>type</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned short&#160;</td>
          <td class="paramname"><em>optype</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>option</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Add a DIME attachment to the SOAP/XML message. </p>
<p>This function adds a DIME attachment to the XML message to send. The specified <code>ptr</code> points to the data to send of length specified by <code>size</code>. The <code>type</code> parameter indicates the MIME type of the data or can be NULL. The <code>id</code> parameter uniquely identifies the attachment in the message, which can be omitted by specifying NULL. The <code>option</code> parameter is an option such as a description of the data and <code>optype</code> is a user-defined option type (as per DIME option specification format). The <code>ptr</code> parameter must be persistent. The <code>ptr</code> parameter passed to this function must be persistent in memory until the attachment was sent. Returns <code><a class="el" href="group__group__errors.html#ga3b10a68f354f39cbb0fe0d043ad4c7c0" title="The soap_status code for no error (zero) ">SOAP_OK</a></code> or a <code><a class="el" href="group__group__errors.html#gac0eadf8f72bacb5b41b750beaeca0444" title="Status and error codes are int values, a zero value or SOAP_OK (0) means no error, nonzero means error. ">soap_status</a></code> error code.</p>
<p>When streaming DIME attachments are enabled by defining the <code><a class="el" href="group__group__callbacks.html#ga068455ce417bddb1636d4d565e0ebf56" title="Callback to open a streaming DIME attachment for reading. ">soap::fdimereadopen</a></code>, <code><a class="el" href="group__group__callbacks.html#ga48270ad98961c3ff48c7b56484ebb3fa" title="Callback to read data in a DIME attachment stream. ">soap::fdimeread</a></code>, <code><a class="el" href="group__group__callbacks.html#ga154752e553be41ed3b10fe3a1273ac71" title="Callback to close a DIME attachment stream after reading. ">soap::fdimereadclose</a></code> then the <code>ptr</code> parameter should point to a user-defined structure that is passed to <code><a class="el" href="group__group__callbacks.html#ga068455ce417bddb1636d4d565e0ebf56" title="Callback to open a streaming DIME attachment for reading. ">soap::fdimereadopen</a></code> as the <code>handle</code> parameter.</p>
<dl class="section user"><dt>Example:</dt><dd></dd></dl>
<div class="fragment"><div class="line"><span class="preprocessor">#include &quot;soapH.h&quot;</span></div><div class="line"></div><div class="line"><span class="keyword">struct </span>soap *soap = <a class="code" href="group__group__context.html#ga51cde138234ed7ec8c4e25bdf6418658">soap_new1</a>(<a class="code" href="group__group__flags.html#gaea7443dc67c979b06cf347ed16db1b51">SOAP_IO_CHUNK</a>);</div><div class="line"><span class="keyword">const</span> <span class="keywordtype">char</span> *data = ...; <span class="comment">// points to data to send</span></div><div class="line"><span class="keywordtype">size_t</span> size = ...;      <span class="comment">// length of the data</span></div><div class="line">soap-&gt;<a class="code" href="structsoap.html#af32b5f3975eac2bd1202571515859163">connect_timeout</a> = 30;                 <span class="comment">// 30 seconds max connect stall time</span></div><div class="line">soap-&gt;<a class="code" href="structsoap.html#a711bb3a53de7cc62429e4d3a2e0b5474">send_timeout</a> = soap_recv_timeout = 5; <span class="comment">// 5 seconds max socket stall time (unlimited by default)</span></div><div class="line">soap-&gt;<a class="code" href="structsoap.html#afcf1d236d052579122f785d7639c43c7">transfer_timeout</a> = 30;                <span class="comment">// 30 seconds max message transfer time (unlimited by default)</span></div><div class="line">soap-&gt;<a class="code" href="structsoap.html#a345900c2db67e915ceb02bfa21ecbcbd">recv_maxlength</a> = 1048576;             <span class="comment">// limit messages received to 1MB (2GB by default)</span></div><div class="line"><a class="code" href="group__group__dime.html#ga742f96848174e27bfc8df7425b870f4b">soap_set_dime_attachment</a>(soap, data, size, <span class="stringliteral">&quot;image/jpg&quot;</span>, NULL, 0, <span class="stringliteral">&quot;Picture&quot;</span>);</div><div class="line"><span class="keywordflow">if</span> (soap_call_ns__webmethod(soap, <a class="code" href="structsoap.html#aed1b86b8a34aea86103751a932c9dce9">endpoint</a>, NULL, ...))</div><div class="line">{</div><div class="line">  <a class="code" href="group__group__fault.html#ga931a4ab6df2553b48a0c270f8a0a88af">soap_print_fault</a>(soap, stderr);</div><div class="line">  <span class="keywordflow">if</span> (soap-&gt;<a class="code" href="structsoap.html#a10b66d6d489690b7d0f591ae2633dd13">errnum</a> == 0) <span class="comment">// timed out, exit program</span></div><div class="line">    exit(EXIT_FAILURE);</div><div class="line">}</div><div class="line"><span class="keywordflow">else</span></div><div class="line">{</div><div class="line">  ... <span class="comment">// success</span></div><div class="line">}</div><div class="line"><a class="code" href="group__group__context.html#gaf7d0176161e9def36981e24faa1913d9">soap_destroy</a>(soap);</div><div class="line"><a class="code" href="group__group__context.html#ga81a009ae1ea825a05e5241e2b7a8ece9">soap_end</a>(soap);</div><div class="line"><a class="code" href="group__group__context.html#ga57108ca4681186e58b5b189c3528f10a">soap_free</a>(soap);</div></div><!-- fragment --><dl class="section see"><dt>See also</dt><dd><code><a class="el" href="structxsd____base64_binary.html" title="XSD base64Binary structure with attachment data. ">xsd__base64Binary</a></code>, <code><a class="el" href="struct__xop_____include.html" title="XOP include structure with attachment data. ">_xop__Include</a></code>, <code><a class="el" href="group__group__misc.html#ga5fcf3c8f6f4bc6d5e6efd7a92ceaf399" title="Returns a randomized unique UUID string. ">soap_rand_uuid</a></code>, <code><a class="el" href="group__group__callbacks.html#ga068455ce417bddb1636d4d565e0ebf56" title="Callback to open a streaming DIME attachment for reading. ">soap::fdimereadopen</a></code>, <code><a class="el" href="group__group__callbacks.html#ga48270ad98961c3ff48c7b56484ebb3fa" title="Callback to read data in a DIME attachment stream. ">soap::fdimeread</a></code>, <code><a class="el" href="group__group__callbacks.html#ga154752e553be41ed3b10fe3a1273ac71" title="Callback to close a DIME attachment stream after reading. ">soap::fdimereadclose</a></code>.</dd></dl>
<dl class="section return"><dt>Returns</dt><dd><code><a class="el" href="group__group__errors.html#ga3b10a68f354f39cbb0fe0d043ad4c7c0" title="The soap_status code for no error (zero) ">SOAP_OK</a></code> or a <code><a class="el" href="group__group__errors.html#gac0eadf8f72bacb5b41b750beaeca0444" title="Status and error codes are int values, a zero value or SOAP_OK (0) means no error, nonzero means error. ">soap_status</a></code> error code </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">soap</td><td><code><a class="el" href="structsoap.html" title="Context with the engine state. ">soap</a></code> context </td></tr>
    <tr><td class="paramname">ptr</td><td>pointer to data </td></tr>
    <tr><td class="paramname">size</td><td>length of the data </td></tr>
    <tr><td class="paramname">type</td><td>MIME type of the data or NULL </td></tr>
    <tr><td class="paramname">id</td><td>content ID of the data or NULL </td></tr>
    <tr><td class="paramname">optype</td><td>a 16 bit DIME option type </td></tr>
    <tr><td class="paramname">option</td><td>one DIME option as a text string or NULL </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<hr class="footer">
<address class="footer">
Copyright (C) 2021, Robert van Engelen, Genivia Inc., All Rights Reserved.
</address>
<address class="footer"><small>
Converted on Tue Apr 20 2021 19:48:13 by <a target="_blank" href="http://www.doxygen.org/index.html">Doxygen</a> 1.8.11</small></address>
<br>
<div style="height: 246px; background: #DBDBDB;">
</body>
</html>
